<template>
	<view class="page" :style="themeColor">
		<view class="flex align-stretch benben-position-layout flex agentApplication_flex_0"
			:style="{ height: 88 + StatusBarRpx + 'rpx', paddingTop: StatusBarRpx + 'rpx' }">
			<view class="flex align-center justify-between flex-sub agentApplication_fd0_0">
				<view class="flex align-center agentApplication_fd0_0_c0" style="padding-top: 8rpx;">
					<person></person>
				</view>
				<view class="flex align-center">
					<text class="agentApplication_fd0_0_c1_c0">我的代理</text>
				</view>
				<view class="flex align-center justify-end agentApplication_fd0_0_c2">
					
				</view>
			</view>
		</view>
		<view :style="{ height: 88 + StatusBarRpx + 'rpx' }"></view>
		
		<view class="loading_css" v-if="isShow">
			<u-loading size="36" color="#6A0002"></u-loading>
			<view class="loading_text">加载中</view>
		</view>
		<block v-else>
			<view style="padding: 8rpx 32rpx 24rpx;background-color: #fff;">
				<back></back>
			</view>
			<view class="flex flex-direction align-stretch benben-flex-layout agentApplication_flex_1">
				<view class="bg_2"></view>
				<view class="tixian">
					<view class="tixian_top flex align-center justify-between">
						<view class="flex align-center justify-center agentApplication_fd1_0">
							<view class="flex flex-direction align-center">
								<view class="agentApplication_fd1_0_c0_c1">我的佣金(元)</view>
								<view class="flex flex-wrap align-center">
									<text class="agentApplication_fd1_0_c0_c0_c0">{{ myJinBi.user_commission }}</text>
								</view>
							</view>
						</view>
						<view class="flex flex-wrap align-center justify-center agentApplication_fd1_1">
							<view class="flex flex-wrap align-center agentApplication_fd1_1_c0">
								<button class="agentApplication_fd1_1_c0_c0" @tap.stop="handleJumpDiy" data-type="navigateTo"
									:data-url="`/pages/qbgl/Withdrawals/Withdrawals?mymoney=${myJinBi.user_commission}`">
									提现
								</button>
							</view>
						</view>
					</view>
					<view class="tixian_bottom">
						<text>我的邀请码：</text>
						<text>{{yaoqingma}}</text>
					</view>
				</view>
			</view>
			
			<view class="flex align-center agentApplication_flex_2">
				<text class="record_icon"></text>
				<text class="agentApplication_fd2_0">推广记录</text>
				<!-- <image class="agentApplication_fd2_1" :src="STATIC_URL + '5.png'" @tap.stop="popupShow1683595961093 = true">
				</image> -->
			</view>
			
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout" v-if="list.length > 0">
				<view class="flex flex-direction flex-wrap align-stretch agentApplication_fd4_0">
					<!-- <view class="flex flex-wrap align-center flex-sub agentApplication_fd4_0_c0">
						<text class="agentApplication_fd4_0_c0_c0">全部人员</text>
						<text class="agentApplication_fd4_0_c0_c1" v-if="list.length > 0">({{list.length}})</text>
					</view> -->
					
					<view class="flex flex-wrap align-center agentApplication_fd4_0_c1" v-for="(item, index) in list" :key="index">
						<image class="agentApplication_fd4_0_c1_c0" mode="aspectFill" :src="item.head_img"></image>
						<view class="flex flex-direction flex-wrap align-stretch flex-sub" style="padding-top: 8rpx;">
							<view class="flex flex-wrap align-center agentApplication_fd4_0_c1_c1_c0">
								<text class="agentApplication_fd4_0_c1_c1_c0_c0">{{ item.user_nickname || '' }}</text>
								<text class="agentApplication_fd4_0_c1_c1_c0_c1">{{ item.mobile || '' }}</text>
							</view>
							<view class="flex flex-wrap align-stretch">
								<view class="agentApplication_fd4_0_c1_c1_c1_c0">{{ item.create_time || '' }}</view>
								<view class="flex flex-wrap align-center agentApplication_fd4_0_c1_c1_c1_c1">
									<view class="">
										<text class="agentApplication_fd4_0_c1_c1_c1_c1_c0">消费：</text>
										<text class="agentApplication_fd4_0_c1_c1_c1_c1_c1">{{ Number(item.use_money) || '' }}</text>
									</view>
									<view class="">
										<text class="agentApplication_fd4_0_c1_c1_c1_c1_c2">佣金：</text>
										<text class="agentApplication_fd4_0_c1_c1_c1_c1_c3">{{ Number(item.change_money) || '' }}</text>
									</view>
								</view>
							</view>
						</view>
					</view>
					<u-loadmore v-if="last_page > 1" class="loadmore" font-size="24" :status="status"
						:icon-type="iconType" :load-text="loadText" />
					
				</view>
			</view>
			<view class="noData_other" v-if="list.length == 0 && !isShow">
				<image src="/static/empty/no.png"></image>
			</view>
		</block>

		
		
		<benben-popup v-model="popupShow1661322664747" :mask="true" mode="center">
			<!---提现规则弹窗flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout agentApplication_flex_3">
				<view class="flex flex-direction align-stretch agentApplication_fd3_0">
					<view class="flex align-center justify-center agentApplication_fd3_0_c0">
						<text class="agentApplication_fd3_0_c0_c0">提现规则</text>
					</view>
					<view class="flex flex-wrap align-center">
						<text class="agentApplication_fd3_0_c1_c0">通过用户端发起提现申请，后台审核通过，线下进行打款
							请您确认绑定的支付宝、微信号的准确性。后台将按照您绑定的提现账户进行进行转账。
							如因提交的信息有误导致的转账失败或转错账户，将由用户自行承担，平台不承担任何责任。</text>
					</view>
				</view>
				<view class="flex align-center justify-center agentApplication_fd3_1">
					<image class="agentApplication_fd3_1_c0" :src="STATIC_URL + '54.png'"
						@tap.stop="popupShow1661322664747 = false"></image>
				</view>
			</view>
		
			<!---提现规则弹窗flex布局结束-->
		</benben-popup>

		<!---flex布局flex布局结束-->
		<benben-popup v-model="popupShow1683595961093" :mask="true" mode="bottom">
			<benben-calendar :query="benbenCalendar" @change="hideDateFunc"> </benben-calendar>
		</benben-popup>
	</view>
</template>
<script>
	import back from "@/components/back/index.vue"
	import person from "@/components/person/index.vue"
	export default {
		components: {
			back,
			person
		},

		data() {
			return {
				popupShow1683595961093: false,
				benbenCalendar: {
					width: 750,
					background: '#ffffff',
					borderRadius: '24rpx 24rpx 0rpx 0rpx',
					mode: 'range',
					future: false,
					changeTitle: true,
					changeYear: true,
					changeMonth: true,
					yearArrowColor: '#666666',
					monthArrowColor: '#999999',
					startText: '开始',
					endText: '结束',
					activeBgColor: '#6A0002',
					rangeBgColor: '#F0E5E5',
				},
				popupShow1661322664747: false,
				myJinBi: {

				},
				Extension: [],
				renyuan: false,
				daili: false,
				yaoqingma: '',
				isshenhe: 0,
				start_time: '',
				end_time: '',
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
				
			}
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
		},
		watch: {},
		onLoad(options) {
		},
		onShow() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getExtension();
			this.getuser()
			this.getmyQian()
		},
		onHide() {},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getExtension();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getExtension();
			}, 500)
		},
		onPageScroll(e) {},
		methods: {
			//隐藏日历
			hideDateFunc(e) {
				setTimeout(() => {
					this.popupShow1683595961093 = false
				}, 200)
				this.start_time = e.start,
				this.end_time = e.end;
				this.page = 1;
				this.is_pull = true;
				this.getExtension();
			},
			//佣金余额
			async getmyQian() {
				let res = await this.$api.post(global.apiUrls.myjinbi)
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.myJinBi = res.data.data
			},
			//申请代理
			async applicationDaili() {
				let res = await this.$api.post(global.apiUrls.applicationAgent)
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.$message.info(res.data.msg)
			},
			//获取信息
			async getuser() {
				let id1 = uni.getStorageSync("USER_INFO")
				this.userid = id1.id
				this.yaoqingma = id1.invite_code
				console.log(this.userid, 'userid')
				let res = await this.$api.post(global.apiUrls.userinfo, {
					user_id: this.userid,
				});
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.usefInfo = res.data.data
				if (this.usefInfo.is_open_agent == 1) {
					this.isshenhe = 1
				} else if (this.usefInfo.is_open_agent == 0) {
					this.isshenhe = 0
				}
			},
			//推广记录
			getExtension() {
				this.$api.post(global.apiUrls.extension, {
					start_time: this.start_time,
					end_time: this.end_time,
					page: this.page
				}).then(res => {
					// console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
		},
	}
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		// background: url(/static/images/4.png) no-repeat, transparent;
		// background-size: 100% auto !important;
	}

	.agentApplication_flex_0 {
		// background: url(/static/images/4.png) no-repeat, transparent;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.agentApplication_fd0_0_c2_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: #fff;
	}

	.agentApplication_fd0_0_c2 {
		width: 226rpx;
	}

	.agentApplication_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		margin-left: 20rpx
	}

	.agentApplication_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #fff;
	}

	.agentApplication_fd0_0_c0 {
		width: 180rpx;
	}

	.agentApplication_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		// line-height: 88rpx;
	}

	.agentApplication_flex_1 {
		// background: #ffffff;
		// margin: 51rpx 0rpx 0rpx 0rpx;
		// border-radius: 16rpx 16rpx 16rpx 16rpx;
		// padding: 80rpx 0rpx 0rpx 0rpx;
		width: 100%;
		height: 338rpx;
		background: url(/static/images/114.png) no-repeat;
		background-size: 100% 100%;
		position: relative;
	}
	.bg_2 {
		width: 100%;
		height: 338rpx;
		background: url(/static/images/115.png) no-repeat;
		background-size: 100% 100%;
		position: absolute;
		top: 10rpx;
		left: 0;
		z-index: 2;
	}
	.tixian {
		background: #fff;
		margin: 69rpx 30rpx 0;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 32rpx 26rpx;
		z-index: 5;
	}
	.tixian_top {
		padding-bottom: 32rpx;
		border-bottom: 1px solid #eee;
	}
	.tixian_bottom {
		padding-top: 32rpx;
		font-size: 24rpx;
		color: #999;
	}

	.agentApplication_fd1_1_c0_c0 {
		background: #6a0002;
		border-radius: 28rpx;
		font-size: 24rpx;
		color: #fff;
		width: 140rpx;
		height: 56rpx;
		line-height: 56rpx;
	}

	.agentApplication_fd1_1_c0 {
		line-height: 33rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #666666;
	}

	.agentApplication_fd1_1 {
		
	}

	.agentApplication_fd1_0_c0_c1 {
		line-height: 33rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #999;
		margin: 0rpx 0rpx 10rpx 0rpx;
	}

	.agentApplication_fd1_0_c0_c0_c0 {
		font-size: 48rpx;
		font-weight: 700;
		color: #333333;
	}

	.agentApplication_fd1_0 {
		
	}

	.agentApplication_flex_2 {
		padding: 32rpx 24rpx 32rpx 24rpx;
		margin: 24rpx 32rpx 24rpx 32rpx;
		display: flex;
	}
	.record_icon {
		display: inline-block;
		width: 6rpx;
		height: 32rpx;
		background: #8B060D;
		border-radius: 100rpx;
		margin-right: 16rpx;
	}

	.agentApplication_fd2_1 {
		width: 36rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.agentApplication_fd2_0 {
		font-size: 32rpx;
		font-weight: bold;
		color: #111;
	}

	.agentApplication_flex_3 {
		width: 540rpx;
	}

	.agentApplication_fd3_1_c0 {
		width: 55rpx;
		height: 55rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.agentApplication_fd3_1 {
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.agentApplication_fd3_0_c1_c0 {
		line-height: 48rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.agentApplication_fd3_0_c0_c0 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}

	.agentApplication_fd3_0_c0 {
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.agentApplication_fd3_0 {
		background: #ffffff;
		background-size: 100% auto !important;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		padding: 32rpx 32rpx 32rpx 32rpx;
	}

	.agentApplication_fd4_0_c1_c1_c1_c1_c3 {
		color: #6a0002;
		font-size: 24rpx;
		font-weight: 400;
	}

	.agentApplication_fd4_0_c1_c1_c1_c1_c2 {
		color: #6a0002;
		font-size: 24rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.agentApplication_fd4_0_c1_c1_c1_c1_c1 {
		color: #6a0002;
		font-size: 24rpx;
		font-weight: 400;
	}

	.agentApplication_fd4_0_c1_c1_c1_c1_c0 {
		color: #6a0002;
		font-size: 24rpx;
		font-weight: 400;
	}

	.agentApplication_fd4_0_c1_c1_c1_c1 {
		margin: 0rpx 0rpx 0rpx auto;
		width: 55%;
		justify-content: space-between;
	}

	.agentApplication_fd4_0_c1_c1_c1_c0 {
		color: #666666;
		font-size: 24rpx;
		font-weight: 400;
		width: 45%;
		display: flex;
		align-items: center;
	}

	.agentApplication_fd4_0_c1_c1_c0_c1 {
		color: #666666;
		font-size: 24rpx;
		font-weight: 400;
	}

	.agentApplication_fd4_0_c1_c1_c0_c0 {
		margin: 0rpx 32rpx 0rpx 0rpx;
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
	}

	.agentApplication_fd4_0_c1_c1_c0 {
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.agentApplication_fd4_0_c1_c0 {
		width: 96rpx;
		height: 96rpx;
		border-radius: 48rpx 48rpx 48rpx 48rpx;
		margin: 0rpx 24rpx 0rpx 0rpx;
	}

	.agentApplication_fd4_0_c1 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		padding: 0rpx 0rpx 32rpx 0rpx;
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.agentApplication_fd4_0_c0_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
	}

	.agentApplication_fd4_0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
	}

	.agentApplication_fd4_0_c0 {
		margin: 0rpx 0rpx 58rpx 0rpx;
	}

	.agentApplication_fd4_0 {
		background: var(--benbenbgColor0);
		margin: 0rpx 32rpx 0rpx 32rpx;
		padding: 32rpx 24rpx 16rpx 24rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}
</style>